﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows;

namespace Broker.View.Converter
{
    public class UIEditConverter : IValueConverter
    {

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string par = parameter.ToString();

            bool isCheck=(bool)value;
            object result = false;


            if (par == "IsEnabled")
                result= !isCheck;
            else if (par == "IsReadOnly")
                result= isCheck;
            if (par == "IsVisibility")
                result = isCheck ? Visibility.Collapsed : Visibility.Visible;

            return result;

        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
